/**
 * Created by xukj on 2018/6/6.
 */

import * as types from '../constants/ActionTypes';

const HomeReducer = (state = { mainPageTo: '未指定' }, action) => {
  console.log('reducer' + action.type);
  switch (action.type) {
    case types.SHOW_AD_DETAIL_PAGE:
      return Object.assign({}, state, {
        mainPageTo: '去指定广告页:' + action.payload,
      });
    case types.SHOW_ARTICLE_DETAIL_PAGE:
      return Object.assign({}, state, {
        mainPageTo: '去指定文章页',
      });
    case types.SHOW_GOODS_DETAIL_PAGE:
      return Object.assign({}, state, {
        mainPageTo: '去指定商品页',
      });
    case types.SHOW_SEARCH_PAGE:
      return Object.assign({}, state, {
        mainPageTo: '去搜索页',
      });
    case types.SHOW_PUBLISH_PAGE:
      return Object.assign({}, state, {
        mainPageTo: '去发布页',
      });
    default:
      return state;
  }
};

export default HomeReducer;